/*
 * Payload.h
 *
 *  Created on: 25.06.2011
 *      Author: mario
 */

#ifndef PAYLOAD_H_
#define PAYLOAD_H_

#include <boost/shared_ptr.hpp>
#include <string>
#include <stdint.h>

// BEACHTE: wenn es hier Änderungen gibt, den Serialisierer anpassen!!

typedef unsigned char byte;

using namespace std;

class Payload_Data
{
public:
  Payload_Data(uint64_t capacity);
  Payload_Data(Payload_Data &other);
//  Payload_Data(byte* data, int len);  // TODO was soll hiermit geschehen? wie's aussieht kann's weg..
  virtual ~Payload_Data();

  int get_size();
  void set_size(uint64_t size);
  string get_key();
  void set_key(string key);
  uint64_t get_postion();
  void set_position(uint64_t pos);

  /* CAUTION! Do not delete[] this pointer */
  byte* raw_pointer();

  /* DO delete[] this pointer */
  byte* return_copy();


  bool operator!(void);

private:
  // private, because we don't want this !!
  void operator=(Payload_Data &other){}


private:
  uint64_t size;
  uint64_t capacity;
  string key;
  uint64_t position;

  byte* payload;
};

typedef boost::shared_ptr<Payload_Data> PayloadPtr;

#endif /* PAYLOAD_H_ */
